#include <cstring>
#include <iostream>
int n;
using namespace std;

// 零分

const int MOD = 1000000007;
const int MAXN = 1005; // 假设地图的最大大小为 1000x1000
char grid[MAXN][MAXN];
int dp1[MAXN][MAXN] = {0};
// dp2[i][j]: number of paths from (n,n) to (i,j)
int dp2[MAXN][MAXN] = {0};

int main() {

  cin >> n;

  // 输入地图，从 (1,1) 开始
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cin >> grid[i][j];
    }
  }

  // dp1[i][j]: number of paths from (1,1) to (i,j)

  // Initialize dp1
  dp1[1][1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (grid[i][1] == '.')
      dp1[i][1] = dp1[i - 1][1];
  }
  for (int j = 2; j <= n; ++j) {
    if (grid[1][j] == '.')
      dp1[1][j] = dp1[1][j - 1];
  }
  for (int i = 2; i <= n; ++i) {
    for (int j = 2; j <= n; ++j) {
      if (grid[i][j] == '.') {
        dp1[i][j] = (dp1[i - 1][j] + dp1[i][j - 1]) % MOD;
      }
    }
  }

  // Initialize dp2
  dp2[n][n] = 1;
  for (int i = n - 1; i >= 1; --i) {
    if (grid[i][n] == '.')
      dp2[i][n] = dp2[i + 1][n];
  }
  for (int j = n - 1; j >= 1; --j) {
    if (grid[n][j] == '.')
      dp2[n][j] = dp2[n][j + 1];
  }
  for (int i = n - 1; i >= 1; --i) {
    for (int j = n - 1; j >= 1; --j) {
      if (grid[i][j] == '.') {
        dp2[i][j] = (dp2[i + 1][j] + dp2[i][j + 1]) % MOD;
      }
    }
  }

  // Calculate the total number of non-crossing paths
  long long total = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (grid[i][j] == '.') {
        total = (total + (long long)dp1[i][j] * dp2[i][j]) % MOD;
      }
    }
  }

  cout << (int)total;

  return 0;
}